﻿<?php
$this->breadcrumbs=array(
	'Swaps'=>array('index'),
	$model->title,
);

if (SwapsController::actionIsAccepted($model->id) == 1)
	{
		$this->beginWidget('zii.widgets.jui.CJuiDialog', array(
		'id'=>'mydialog',
		// additional javascript options for the dialog plugin
		'options'=>array(
        'title'=>'Infromation',
        'autoOpen'=>true,
		),
		));

		echo 'Lejárt';

		$this->endWidget('zii.widgets.jui.CJuiDialog');
	}
?>


<table>
<tr>
	<td>
		<h1><?php echo $model->title; ?></h1>
	</td>
	<td>
		<?php 
		if (!Yii::app()->user->isGuest && SwapsController::actionIsCreator($model->id) == 1 ) 
			{
				echo CHtml::link('DeleteSwap',array('Delete','id'=>$model->id));
			}
		?>
	</td>
	<td>
		<?php
		if (!Yii::app()->user->isGuest) {
	
			if (SwapsController::actionIsOffered($model->id) == 1)
			{
				echo CHtml::link('Visszavonom',array('DisOffer','id'=>$model->id));
			}
			else
			{
				echo CHtml::link('Add offer',array('Offer','id'=>$model->id));
			}
			
		}	
		?>
	</td>
</tr>
</table>
<table>
<tr>
	<td>
		<img src="/files/default_noimg.jpg" alt="UserImage" height="150" width="150">
	</td>
	<td>
		<?php 
			
			echo "Creator: valaki";
			echo '</br>';
			echo $model->date;
			echo '</br>';
			echo $model->valid_until;
		?>
	</td>
</tr>
<tr>
	<td>
		<?php echo $model->description; ?>
	<td>
</table>

<?php 

$this->widget('bootstrap.widgets.TbButton', array(
    'label'=>'Segítség',
    'type'=>'primary',
    'htmlOptions'=>array(
        'data-toggle'=>'modal',
        'data-target'=>'#myModal',
    ),
)); ?>

<?php 
	echo "</br></br><b>Ajánlatok:</b>";
	$this->widget('zii.widgets.CListView', array(
	'dataProvider'=>$dataProvider,
	'itemView'=>'_viewOffers',
	'summaryText' => '',
	)); 
?>

<?php $this->beginWidget('bootstrap.widgets.TbModal', array('id'=>'myModal')); ?>
 
<div class="modal-header">
    <a class="close" data-dismiss="modal">&times;</a>
    <h4>Information</h4>
</div>
 
<div class="modal-body">
   Description of usage </br>
   from db
</div>
 
<div class="modal-footer">
     <?php $this->widget('bootstrap.widgets.TbButton', array(
        'label'=>'Bezár',
        'url'=>'#',
        'htmlOptions'=>array('data-dismiss'=>'modal'),
    )); ?>
</div>
 
<?php $this->endWidget(); ?>

